<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>curry</title>
</head>

<body>
    <script>
        const curry = (fn, arity = fn.length, ...args) =>
            arity <= args.length ? fn(...args) : curry.bind(null, fn, arity, ...args);
        console.log(curry(Math.pow)(2)(10)); // 1024
        console.log(curry(Math.min, 3)(10)(50)(2)); // 2
    </script>
</body>

</html>